﻿using System;

namespace WPHttpServer
{
    public class ImageResponseContentProvider : IResponseContentProvider
    {
        public byte[] ImageData { get; set; }
        public ImageFormat Format { get; set; }

        public ImageResponseContentProvider(byte[] imageData, ImageFormat format)
        {
            ImageData = imageData;
            Format = format;
        }

        public string ContentMediaTypeName
        {
            get
            {
                return "image/" + Enum.GetName(typeof(ImageFormat), this.Format).ToLower();
            }
        }

        public byte[] GetContentData()
        {
            return ImageData;
        }
    }

    public enum ImageFormat
    {
        Png,
        Jpeg,
    }
}
